<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('兽药出库记录列表')"/>
    <th:block th:include="include :: select2-css"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">


        <div class="col-sm-12 search-collapse">
            <span class="btn-group " style="margin: 0px auto;display: table;" role="group">
                <button type="button" id="ncDrugs" class="top-link btn btn-sm btn-white">兽药管理</button>
                <button type="button" id="ncDrugsLogs" class="top-link btn-sm btn-primary">出库记录</button>
            </span>
        </div>


        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            兽药名称：<input type="text" name="drugName"/>
                        </li>

                       <!-- <li>
                            出库数量：<input type="text" name="outputAmount"/>
                        </li>-->

                        <!--<li>
                            单位：<input type="text" name="unit"/>
                        </li>-->

                        <li class="select-time">
                            <label>巡视时间： </label>
                            <input class="time-input" id="beginTime" name="params[beginTime]" placeholder="开始时间"
                                   type="text"/>
                            <span>-</span>
                            <input class="time-input" id="endTime" name="params[endTime]" placeholder="结束时间"
                                   type="text"/>
                        </li>


                        <li>
                            经手人: <select id="createBy" name="createBy">
                            <option value="" selected="selected">无</option>
                            <option th:each="user:${users}" th:value="${user.loginName}" th:text="${user.loginName}"></option>
                                    </select>
                        </li>

                        <li>
                            领用人: <select id="receiver" name="receiver">
                            <option value="" selected="selected">无</option>
                            <option th:each="user:${users}" th:value="${user.loginName}" th:text="${user.loginName}"></option>
                                    </select>
                        </li>

                        <!--<li>
                            备注：<input type="text" name="remark"/>
                        </li>-->

                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:ncDrugsLogs:add">
                <i class="fa fa-plus"></i> 添加
            </a>
            <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:ncDrugsLogs:edit">
                <i class="fa fa-edit"></i> 修改
            </a><!--
            <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:ncDrugsLogs:remove">
                <i class="fa fa-remove"></i> 删除
            </a>-->
            <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:ncDrugsLogs:export">
                <i class="fa fa-download"></i> 导出
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table" data-mobile-responsive="true"></table>
        </div>
    </div>
</div>
<div th:include="include :: footer"></div>
<th:block th:include="include :: select2-js"/>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('system:ncDrugsLogs:edit')}]];
    var removeFlag = [[${@permission.hasPermi('system:ncDrugsLogs:remove')}]];
    var prefix = ctx + "system/ncDrugsLogs";

    $(function () {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "兽药出库记录",
            uniqueId : "drugLogId",
            showExport: true,
            columns: [{
                checkbox: true
            },

                {
                    title: '序号',
                    formatter: function (value, row, index) {
                        return $.table.serialNumber(index);
                    }
                },
                {
                    field: 'drugLogId',
                    title: '兽药出库记录id',
                    visible: false
                },
                {
                    field: 'drugId',
                    title: '兽药id',
                    sortable: false,
                    visible: false
                },
                {
                    field: 'drugCode',
                    title: '兽药批次',
                    sortable: true
                },
                {
                    field: 'drugName',
                    title: '兽药名称',
                    sortable: true
                },
                {
                    field: 'factory',
                    title: '生产厂家',
                    sortable: true
                },
                {
                    field: 'outputAmount',
                    title: '出库数量',
                    sortable: true
                },
                {
                    field: 'unit',
                    title: '单位规格',
                    sortable: true
                },
                {
                    field: 'createTime',
                    title: '出库时间',
                    sortable: true
                },
                {
                    field: 'createBy',
                    title: '出库经手人',
                    sortable: true
                },
                {
                    field: 'receiver',
                    title: '出库领用人',
                    sortable: true
                },
                {
                    field: 'mainFunction',
                    title: '功能主治',
                    formatter: function (value, row, index) {
                        return $.table.tooltip(value,30)
                    }
                },
                {
                    field: 'remark',
                    title: '备注',
                    formatter: function (value, row, index) {
                        return $.table.tooltip(value);
                    }
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.drugLogId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.drugLogId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);


		$("#ncDrugs").click(function () {
			window.location.href = ctx + 'system/ncDrugs';
			return;
		});

		$("#ncDrugsLogs").click(function () {
			window.location.href = ctx + 'system/ncDrugsLogs';
			return;

		});
    });
    setTitle("兽医管理-兽药管理-出库记录",true)
</script>
</body>
</html>